//
// MethodHandler.h
//
// Library: RemotingNG
// Package: ORB
// Module:  MethodHandler
//
// Definition of the MethodHandler class.
//
// Copyright (c) 2006-2014, Applied Informatics Software Engineering GmbH.
// All rights reserved.
//
// SPDX-License-Identifier: GPL-3.0-only
//


#ifndef RemotingNG_MethodHandler_INCLUDED
#define RemotingNG_MethodHandler_INCLUDED


#include "Poco/RemotingNG/RemotingNG.h"
#include "Poco/RemotingNG/RemoteObject.h"
#include "Poco/RefCountedObject.h"
#include "Poco/AutoPtr.h"


namespace Poco {
namespace RemotingNG {


class ServerTransport;
class Deserializer;


class RemotingNG_API MethodHandler: public Poco::RefCountedObject
	/// A MethodHandler deserializes and forwards a remote call to the service object,
	/// via the RemoteObject.
	///
	/// MethodHandler classes are generated by the RemotingNG code generator,
	/// together with the Skeleton class, which manages them.
{
public:
	using Ptr = Poco::AutoPtr<MethodHandler>;

	MethodHandler();
		/// Creates a MethodHandler.

	virtual ~MethodHandler();
		/// Destroys the MethodHandler.

	virtual void invoke(ServerTransport& transport, Deserializer& deserializer, RemoteObject::Ptr pRemoteObject) = 0;
		/// Deserializes the incoming request using the given Deserializer and
		/// invokes the corresponding method on the service object, via the RemoteObject.
		///
		/// After the invocation, serializes the return value and output parameters (or exception) of the
		/// method using the ServerTransport's Serializer.

private:
	MethodHandler(const MethodHandler&);
	MethodHandler& operator = (const MethodHandler&);
};


} } // namespace Poco::RemotingNG


#endif // RemotingNG_MethodHandler_INCLUDED
